<template>
  <div class="page-widget">
    <div class="widget-toolbar">
      {{widget.title}}-页面
      <span @click.stop="showConf"><icon name="cog" class="widget-setting"></icon></span>
    </div>
    <div class="widget-content">
      <page-examine-time v-if="widget.code === 'examine-time'" :reportData="reportData" :widget="widget"
                         :showConfDialog="showConfDialog"
                         @done="confDone"></page-examine-time>
      <page-report-sn v-if="widget.code === 'report-sn'" :reportData="reportData" :widget="widget"
                      :showConfDialog="showConfDialog"
                      @done="confDone"></page-report-sn>
      <null-space v-if="widget.code === 'null-space'" :reportData="reportData" :widget="widget"
                  :showConfDialog="showConfDialog"
                  @done="confDone"></null-space>
      <user-info v-if="widget.code === 'user-info'" :reportData="reportData" :widget="widget"
                 :showConfDialog="showConfDialog"
                 @done="confDone"></user-info>
      <page-tizhi-a v-if="widget.code === 'tizhi-a'" :reportData="reportData" :widget="widget"
                    :showConfDialog="showConfDialog"
                    @done="confDone"></page-tizhi-a>
      <page-tizhi-b v-if="widget.code === 'tizhi-b'" :reportData="reportData" :widget="widget"
                    :showConfDialog="showConfDialog"
                    @done="confDone"></page-tizhi-b>
      <page-tizhi-c v-if="widget.code === 'tizhi-c'" :reportData="reportData" :widget="widget"
                    :showConfDialog="showConfDialog"
                    @done="confDone"></page-tizhi-c>
      <page-tizhi-d v-if="widget.code === 'tizhi-d'" :reportData="reportData" :widget="widget"
                    :showConfDialog="showConfDialog"
                    @done="confDone"></page-tizhi-d>
      <page-tizhi-e v-if="widget.code === 'tizhi-e'" :reportData="reportData" :widget="widget"
                    :showConfDialog="showConfDialog"
                    @done="confDone"></page-tizhi-e>
      <page-fangan-a v-if="widget.code === 'fangan-a'" :reportData="reportData" :widget="widget"
                     :showConfDialog="showConfDialog"
                     @done="confDone"></page-fangan-a>
      <page-fangan-b v-if="widget.code === 'fangan-b'" :reportData="reportData" :widget="widget"
                     :showConfDialog="showConfDialog"
                     @done="confDone"></page-fangan-b>
      <page-fangan-c v-if="widget.code === 'fangan-c'" :reportData="reportData" :widget="widget"
                     :showConfDialog="showConfDialog"
                     @done="confDone"></page-fangan-c>
      <page-fangan-d v-if="widget.code === 'fangan-d'" :reportData="reportData" :widget="widget"
                     :showConfDialog="showConfDialog"
                     @done="confDone"></page-fangan-d>
      <page-fangan-e v-if="widget.code === 'fangan-e'" :reportData="reportData" :widget="widget"
                     :showConfDialog="showConfDialog"
                     @done="confDone"></page-fangan-e>
      <page-fangan-f v-if="widget.code === 'fangan-f'" :reportData="reportData" :widget="widget"
                     :showConfDialog="showConfDialog"
                     @done="confDone"></page-fangan-f>
      <page-fangan-g v-if="widget.code === 'fangan-g'" :reportData="reportData" :widget="widget"
                     :showConfDialog="showConfDialog"
                     @done="confDone"></page-fangan-g>
      <page-fangan-h v-if="widget.code === 'fangan-h'" :reportData="reportData" :widget="widget"
                     :showConfDialog="showConfDialog"
                     @done="confDone"></page-fangan-h>
      <page-fangan-i v-if="widget.code === 'fangan-i'" :reportData="reportData" :widget="widget"
                     :showConfDialog="showConfDialog"
                     @done="confDone"></page-fangan-i>
      <page-report-intro v-if="widget.code === 'report-intro'" :reportData="reportData" :widget="widget"
                         :showConfDialog="showConfDialog"
                         @done="confDone"></page-report-intro>
      <page-jk-record v-if="widget.code === 'jk-record'" :reportData="reportData" :widget="widget"
                      :showConfDialog="showConfDialog"
                      @done="confDone"></page-jk-record>
    </div>
  </div>
</template>

<script>
  import Vue from 'vue'
  import NullSpace from "./null-space";
  import UserInfo from "./user-info";
  import PageTizhiA from "./tizhi-a";
  import PageTizhiB from "./tizhi-b";
  import PageTizhiC from "./tizhi-c";
  import PageTizhiD from "./tizhi-d";
  import PageTizhiE from "./tizhi-e";
  import PageFanganA from "./fangan-a";
  import PageFanganB from "./fangan-b";
  import PageFanganC from "./fangan-c";
  import PageFanganD from "./fangan-d";
  import PageFanganE from "./fangan-e";
  import PageFanganF from "./fangan-f";
  import PageFanganG from "./fangan-g";
  import PageFanganH from "./fangan-h";
  import PageReportSn from "./report-sn";
  import PageExamineTime from "./examine-time";
  import PageFanganI from "./fangan-i";
  import PageReportIntro from "./report-intro";
  import PageJkRecord from "./jk-record";

  export default {
    components: {
      PageJkRecord,
      PageReportIntro,
      PageExamineTime,
      PageReportSn,
      PageFanganI,
      PageFanganH,
      PageFanganG,
      PageFanganF,
      PageFanganE,
      PageFanganD,
      PageFanganC,
      PageFanganB,
      PageFanganA,
      PageTizhiE,
      PageTizhiD,
      PageTizhiC,
      PageTizhiB,
      PageTizhiA,
      UserInfo,
      NullSpace
    },
    name: "page-widget",
    props: ['widget', 'reportData'],
    data() {
      return {
        showConfDialog: false,
      }
    },
    created() {
      if (!this.widget.data)
        Vue.set(this.widget, 'data', {})
    },
    methods: {
      showConf(e) {
        this.showConfDialog = true
      },
      confDone(p) {
        console.log('页面里的————————————',p)
        this.showConfDialog = false
        //提示保存页面
        this.$emit('done', p)
      },
    }
  }
</script>

<style lang="scss">
  .page-widget {
    margin:0 0 20px 0;
    border: 1px solid #888;
    .widget-toolbar {
      height: 26px;
      .widget-setting {
        float: right;
        color: #666;
        margin: 4px;
        display: none;
        cursor: pointer;
      }
      &:hover {
        .widget-setting {
          display: inline;
        }
      }
    }
  }
</style>
